import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import javax.swing.JPanel;

public class Zone {
	
	//all zones are rectangles
	private Point upperLeft;
	private int xSize, ySize;
	private Robot.Alliance alliance;
	public static Color fadedRed = new Color(255, 109, 109);
	public static Color fadedBlue = new Color(140, 143, 240);
	
	public Zone (Point upperLeft, int xSize, int ySize, Robot.Alliance alliance) {
		this.upperLeft = upperLeft;
		this.xSize = xSize;
		this.ySize = ySize;
		this.alliance = alliance;
	}
	
	public Robot.Alliance getAlliance(){
		return alliance;
	}
	
	//draw a zone
	public void drawZone(Graphics page){
		if(alliance == Robot.Alliance.red){
			page.setColor(fadedRed);
		}
		else if(alliance == Robot.Alliance.blue){
			page.setColor(fadedBlue);
		}
		else if(alliance == Robot.Alliance.neutral){
			page.setColor(Color.lightGray);
		}
		page.fillRect(upperLeft.x, upperLeft.y, xSize, ySize);		
	}

	public Point getUpperLeft() {
		return upperLeft;
	}

	public void setUpperLeft(Point upperLeft) {
		this.upperLeft = upperLeft;
	}

	public int getxSize() {
		return xSize;
	}

	public void setxSize(int xSize) {
		this.xSize = xSize;
	}

	public int getySize() {
		return ySize;
	}

	public void setySize(int ySize) {
		this.ySize = ySize;
	}
	
	public int getXMin(){
		return upperLeft.x;
	}
	
	public int getYMin(){
		return upperLeft.y;
	}
	
	public int getXMax(){
		return upperLeft.x + xSize;
	}
	
	public int getYMax(){
		return upperLeft.y + ySize;
	}
	
}
